<?php

// +----------------------------------------------------------------------
// | 任务关联标签数据表
// +----------------------------------------------------------------------

namespace common\model;

use think\model\RelationModel;

class TaskRelationTagModel extends RelationModel
{

    //自动验证
    protected $_validate = [
        ['task_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], //必须字段
        ['link_module_code', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], //必须字段
        ['link_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], //必须字段
        ['link_module_code', '1,128', '', self::EXISTS_VALIDATE, 'length'],
    ];

    //自动完成
    protected $_auto = [

        ['tenant_id', 'auto_fill_tenant_id', self::MODEL_INSERT, 'function'],
        ['created_by', 'fill_created_by', self::MODEL_INSERT, 'function'],
        ['created', 'time', self::MODEL_INSERT, 'function'],
        ['updated', 'time', self::MODEL_UPDATE, 'function'],
    ];

    protected $_validate_after_auto = [

        ['task_id,link_module_code,link_id', '', '', self::MUST_VALIDATE, 'unique'],
    ];
}
